<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>form-serialize</title>
    <!-- 快速收集表单元素 -->

</head>

<body>

    <form>
        <div name="box" style="border: 2px solid rgb(233, 233, 240) ;width:300px;margin: auto;text-align: center;">
            <h1>欢迎-注册</h1>
            <h3>账号名:</h3>
            <input type=" text" name="username">
            <h3>邮箱:</h3>
            <input type=" text" name="youxiang">
            <h3>手机号:</h3>
            <input type=" text" name="phonenum">
            <h3>户口所在地:</h3>
            <input type=" text" name="hukou">
            <h3>密码:</h3>
            <input name="password" type="text" style="margin-bottom: 20px;"><br>
            <button style=" color: blue">注册</button>
        </div>
    </form>
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <!-- <script src="n/form-serialize/dist/form-serialize.min.js"></script> -->
    <script>
        document.querySelector('button').addEventListener('click', async () => {
            const serialize = await import('form-serialize');
            const form = document.querySelector('form')
            const data = serialize(form, { hash: true, empty: true })
            console.log(data);
            console.log(form);
        })
    </script>

</body>

</html>